﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace HybridLab.Virtual.Interfaces
{
	/// <summary>
	/// A catalog for finding IVirtualHost implementations and connecting to hosts
	/// </summary>
    public sealed class VirtualHostCatalog
    {
		/// <summary>
		/// Uses MEF to discover IVirtualHost implementations and returns all the Host Types
		/// </summary>
		/// <returns>A List of Host Types available</returns>
		public static List<string> GetHostTypes()
		{
			return new VirtualHostContainer().GetHostTypes();
		}

		/// <summary>
		/// Instantiates an IVirtualHost implementation and calls Connect() before returning the host object
		/// </summary>
		/// <param name="hostType">The type of host to connect to</param>
		/// <param name="hostName">The name of the host</param>
		/// <param name="domain">Domain for the credentials</param>
		/// <param name="userName">Username for connection</param>
		/// <param name="password">Password for connection</param>
		/// <returns>An IVirtualHost object</returns>
		public static IVirtualHost GetHost(string hostType, string hostName, string domain = "", string userName = "", string password = "")
		{
			return new VirtualHostContainer().GetHost(hostType, hostName, domain, userName, password);
		}
    }
}
